package homework;
import java.util.Scanner;
public class Demo6 {
    public static void main(String[] args) {
    sjx();
    zfx();
    cfx();
}

    public static void sjx() {
        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入三角形的底: ");
        double a = scanner.nextDouble();
        System.out.println("请输入三角形的高: ");
        double b = scanner.nextDouble();
        System.out.println("三角形的面积为: " + (a * b) / 2);
    }

    public static void zfx() {
        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入正方形的边: ");
        double a = scanner.nextDouble();
        System.out.println("正方形的面积为: " + a * a);
    }

    public static void cfx() {
        Scanner scanner = new Scanner(System.in);
        System.out.println("请输入长方形的长: ");
        double a = scanner.nextDouble();
        System.out.println("请输入三角形的宽: ");
        double b = scanner.nextDouble();
        System.out.println("长方形的面积为: " + a * b);
    }
}


